package shopping;
import java.util.*;
import shopping.Allgoods;
import shopping.shoppcar;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int sum=0;
		Allgoods sa;
		int m = sc.nextInt();
		for(int i=0;i<m;i++) {
			sa = new Allgoods(sc.next(),sc.nextInt(),sc.next(),sc.nextInt());
			
		}
		Allgoods.Display();
		
		shoppcar ss;
		int n = sc.nextInt();
		for(int i=0;i<n;i++) {
			ss = new shoppcar(sc.next(),sc.nextInt(),sc.next(),sc.nextInt());
			
		}
		shoppcar.Display();
		
	}
	
}
